package com.zk.shop.servlet.user;

import com.zk.shop.entity.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @ClassName LoginSuccessServlet
 * @Description TODO
 * @Author 来永刚
 * @Date 2019/10/9 0009上午 10:17
 * @Version 1.0
 **/
@WebServlet("user/LoginSuccessServlet")
public class LoginSuccessServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        User user = (User) req.getSession().getAttribute("user");
        if (user!=null) {
            resp.getWriter().print("true");
        } else {
            resp.getWriter().print("false");
        }
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
